<div class="table-box">
    <script type="text/html" id="toolbarDemo_flowlog">操作记录</script>
    <div class="tableShow">
        <table id="datalist_flowlog" lay-filter="datalist_flowlog"></table>
    </div>
</div>

<div class="table-box">
    <div class="title">浏览记录</div>
    <table class="layui-table">
        <tbody>
        <tr>
            <td class="tt">浏览记录</td>
            <td>
                <div class="browse-list" id="reads-list">
                    <div style="text-align: center;color: #aaa;width: 100%;margin-bottom:10px;">
                        <div><div><img style="width:70px;" src="/static/admin/images/welnodata.png" /></div><span>暂无数据</span></div>
                        <!-- 无数据 -->
                    </div>
                </div>
            </td>
        </tr>
        </tbody>
    </table>
</div>



<script>


    function public_get_readsandlog(table, mid) {
        facade.ajax({url: ask_opt_get_readsandlog, data:{table:table,mid:mid}}).done(function(res){
            if (res.code === 2000) {
                if(res.data.dataDelStr){
                    $(".pageshowtitle").after('<span class="data-del-span">'+res.data.dataDelStr+'</span>')
                }

                layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
                    var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

                    table.render({
                        elem: "#datalist_flowlog",data:res.data.flowlog, toolbar: '#toolbarDemo_flowlog', page: false
                        ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                        ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                        ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                        , cols: [[
                            {type:'numbers',title:'序号',fixed:'left'}
                            ,{field: 'created_at', title: '操作时间'}
                            ,{field: 'name', title: '动作'}
                            ,{field: 'created_user', title: '处理人'}
                            ,{field: 'statusname', title: '状态'}
                            ,{field: 'explain', title: '说明'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                        }
                    });



                });




                let flowlog_str = '',reads_str = '';
                let flowlog = res.data.flowlog, reads = res.data.reads;
                for (let i=0; i<flowlog.length; i++){
                    let _num = parseInt(i + 1);
                    flowlog_str += '<tr>';
                    flowlog_str += '<td style="min-width: 10px">'+_num+'</td>';
                    flowlog_str += '<td>'+flowlog[i].created_at+'</td>';
                    flowlog_str += '<td>'+flowlog[i].name+'</td>';
                    flowlog_str += '<td>'+flowlog[i].created_user+'</td>';
                    flowlog_str += '<td>'+flowlog[i].statusname+'</td>';
                    flowlog_str += '<td>'+flowlog[i].explain+'</td>';
                    flowlog_str += '</tr>';
                }
                if(flowlog_str == ''){
                    flowlog_str += file_none(6);
                }
                file_assign('#flowlog-tbody', flowlog_str);


                for (let i=0; i<reads.length; i++){
                    let _num = parseInt(i + 1);
                    reads_str += '<div class="browse-box reads-tip-msg" tipmsg="'+reads[i].stotal+'次浏览，最后于'+reads[i].optdt+'">';

                    if(reads[i].avatar){
                        reads[i].avatar = get_file_complete(reads[i].avatar)
                    }else{
                        reads[i].avatar = "/static/admin/images/avatar.png";
                    }

                    reads_str += '<div class="browse-div"><img src="'+reads[i].avatar+'"></div>';
                    reads_str += '<div class="browse-div">'+reads[i].realname+'</div>';
                    reads_str += '</div>';
                }
                if(reads_str){
                    $('#reads-list').html(reads_str);
                }


            }
        });

    }



    var reads_layer_tips = 0;
    $(document).on('mouseenter', '.reads-tip-msg', function () {
        reads_layer_tips = layer.tips($(this).attr('tipmsg'), this, {time: 0, tips:1});
    }).on('mouseleave', '.reads-tip-msg', function () {
        layer.close(reads_layer_tips);
    });
</script>


